package com.mytaobao.main.firsttab.func.chaoshihui;

import android.content.Context;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.baseproject.adapter.ItemViewDelegate;
import com.baseproject.adapter.ViewHolder;
import com.mytaobao.R;
import com.mytaobao.util.Const;

import java.util.ArrayList;
import java.util.List;

/**
 * 超实惠--天猫必逛--特色好货
 */
public class ChaoShiHuiItemDelegate implements ItemViewDelegate<List<String>> {

    private List<String> mItemChaoShiHui;

    public ChaoShiHuiItemDelegate() {
        mItemChaoShiHui = new ArrayList<>();
    }

    @Override
    public int getItemViewLayoutId() {
        return R.layout.adapter_firsttab_chao_shi_hui;
    }

    @Override
    public int getItemViewType() {
        return Const.TYPE_CHAO_SHI_HUI;
    }

    @Override
    public void convert(ViewHolder holder, int position) {
        if(mItemChaoShiHui.size() > 0) {
            ((HotViewHolder)holder).itemChaoShiHuiView.setData(mItemChaoShiHui);
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return false;
    }

    @Override
    public ViewHolder createViewHolder(Context context, ViewGroup parent) {
        View itemView = LayoutInflater.from(context).inflate(getItemViewLayoutId(), parent, false);
        ViewHolder holder = new HotViewHolder(context, itemView);
        return holder;
    }


    View mItemView;
    private final class HotViewHolder extends ViewHolder {
        public ItemChaoShiHuiView itemChaoShiHuiView;
        public HotViewHolder(Context context, View itemView) {
            super(context, itemView);
            mItemView = itemView;
            itemChaoShiHuiView = (ItemChaoShiHuiView) itemView.findViewById(R.id.item_chao_shi_hui);
        }
    }

    @Override
    public int getItemCount() {
        return 1;
    }

    @Override
    public void updateData(List<String> strings) {

    }
}
